<?php
/**
 * Created by PhpStorm.
 * User: FoxxxZhu
 * Date: 2017/12/26
 * Time: 17:18
 */

namespace Forxx;

use Lavender\Dao\RedisTable;

class RedisLock extends RedisTable{
    protected $table = 'common';
    protected $prefix = "lock::";

    /**
     * @param $name
     * @param int $seconds
     */
    public function getLock($name,$seconds  = 10)
    {
        $key = $this->makeKey($name);
        return $this->get_handle()->set($key,1,"EX",$seconds,"NX");
    }
}

